import { IProfile } from './../store/reducer/user';
import request from '@/utils/request';
export const getUserInfoAPI = () => {
  return request({ url: '/v1_0/user' });
};

export const getProfileAPI = () => {
  return request({ url: '/v1_0/user/profile' });
};

export const updatePhotoAPI = (data: FormData) => {
  return request({
    url: '/v1_0/user/photo',
    method: 'patch',
    data,
  });
};

// 💥泛型工具：Partial
// 作用：将对象的所有键转为可选
// 语法： Partial<类名别名>

// 1. 封装API
export const updateProfileAPI = (data: Partial<IProfile>) => {
  return request({
    url: '/v1_0/user/profile',
    method: 'patch',
    data: data,
  });
};
